//对用户命令行的输入进行编码的处理

let userName = process.argv[2];
let pwd = process.argv[3];

let userInfor = userName + ":" + pwd;

//将字符串转换得到buffer实例
let buf = Buffer.from(userInfor, "utf-8");
//将buffer实例进行编码转换成base64字符串
let base64Str = buf.toString("base64");

console.log(userInfor);//zhangsan:123
console.log(buf);//<Buffer 7a 68 61 6e ...>
console.log(base64Str);//emhhbmdzYWe6MTIz
